package com.hks360.car_treasure.multimedia;

import android.content.Context;
import android.media.AudioManager;
import android.media.SoundPool;

import com.hks360.car_treasure.R;

import java.util.HashMap;

/**
 * Created by rwq on 2016/5/9.
 */
public class Sound {
    private SoundPool soundPool;
    private HashMap<Integer,Integer> soundMap = new HashMap<>();
    private Context mContext;
    public static int START = 1;
    public static int NORMAL = 2;
    public static int END = 3;

    public Sound(Context context) {
        mContext = context;
        soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC,5);
        soundMap.put(1,soundPool.load(mContext, R.raw.start,1));
        soundMap.put(2,soundPool.load(mContext, R.raw.normal,1));
        soundMap.put(3,soundPool.load(mContext, R.raw.end,1));
    }

    public void play(int id){
        soundPool.play(soundMap.get(id),1,1,0,0,1);
    }

}
